package com.common.context;

public class UserContext {
    private static final ThreadLocal<Long> usersLocal = new ThreadLocal<>();
    private static final ThreadLocal<String> usersToken = new ThreadLocal<>();

    protected UserContext() {}

    public void setUsersId(Long id) {
        usersLocal.set(id);
    }

    public Long getUsersId() {
        return usersLocal.get();
    }

    public void setUsersToken(String token) {
        usersToken.set(token);
    }

    public String getUsersToken() {
        return usersToken.get();
    }

    public void clear() {
        usersLocal.remove();
        usersToken.remove();
    }

}
